package asteroids.model.expressions;

import java.util.HashMap;

/**
 * A subclass of expression (E) that represents the expression of getting the direction (getdir) of his executer
 * 
 * @version 1.0
 * 
 * @author	Thijs Peirelinck & Wouter Parys
 *
 */
public class GetDirection extends ExecuterExpression {
	
	public GetDirection() {
	}
	
	@Override
	public Double getValue() {
		return getExecuter().getOrientation();
	}
	
	@Override
	public boolean isValidExpression() {
		return true;
	}
	
	@Override
	public String toString() {
		return "direction";
	}

	@Override
	public String getReturnType() {
		return "double";
	}

	@Override
	public void validate(HashMap<String, E> variables) {
		//do nothing
	}
	
	@Override
	public E createCopy() {
		GetDirection direction = new GetDirection();
		assert (this.getExecuter() != null);
		direction.setExecuter(getExecuter());
		return direction;
	}
}
